class modalBox extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      view: false
    };
  }

  componentDidMount() {
    const zise = this.props.size || '';
    switch (zise) {
      case 'sm':
        this.setState({
          className:  'modal fade bs-example-modal-sm',
          dialogClass: 'modal-dialog modal-sm',
          view: true
        })
        break;

      case 'lg':
        this.setState({
          className:  'modal fade bs-example-modal-lg',
          dialogClass: 'modal-dialog modal-lg',
          view: true
        })
        break;

      default:
        this.setState({
          className:  'modal fade',
          dialogClass: 'modal-dialog',
          view: true
        })
    }
  }

  render() {
    return (
      this.state.view
      ? <div className={this.props.close ? this.state.className : `${this.state.className} active`}>
          <div className={this.state.dialogClass} >
            <div className="modal-content">
              {this.props.children}
            </div>
          </div>
        </div>
      : <div></div>
    )
  }
}

module.exports = modalBox;
